package com.tcdp.models;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * The persistent class for the blog_post_tbl database table.
 * 
 */
@Entity
@Table(name="blog_post_tbl")
public class BlogPost extends AbstractModel implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="blog_post_id")
	private int blogPostId;

	@Column(name="blog_post_author")
	private String blogPostAuthor;

	@Lob
	@Column(name="blog_post_content")
	private String blogPostContent;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="blog_post_date")
	private Date blogPostDate;

	@Column(name="blog_post_enable_comments")
	private boolean blogPostEnableComments;

	@Column(name="blog_post_title")
	private String blogPostTitle;

	@Column(name="blog_post_url")
	private String blogPostUrl;

	//bi-directional many-to-one association to BlogPostComment
	@OneToMany(mappedBy="blogPost")
	private List<BlogPostComment> blogPostComments;

	//bi-directional many-to-one association to BlogPostTag
	@OneToMany(mappedBy="blogPost")
	private List<BlogPostTag> blogPostTags;

	//bi-directional many-to-one association to BlogCategory
	@ManyToOne
	@JoinColumn(name="blog_category_id")
	private BlogCategory blogCategory;

	public BlogPost() {
	}

	public int getBlogPostId() {
		return this.blogPostId;
	}

	public void setBlogPostId(int blogPostId) {
		this.blogPostId = blogPostId;
	}

	public String getBlogPostAuthor() {
		return this.blogPostAuthor;
	}

	public void setBlogPostAuthor(String blogPostAuthor) {
		this.blogPostAuthor = blogPostAuthor;
	}

	public String getBlogPostContent() {
		return this.blogPostContent;
	}

	public void setBlogPostContent(String blogPostContent) {
		this.blogPostContent = blogPostContent;
	}

	public Date getBlogPostDate() {
		return this.blogPostDate;
	}

	public void setBlogPostDate(Date blogPostDate) {
		this.blogPostDate = blogPostDate;
	}

	public boolean getBlogPostEnableComments() {
		return this.blogPostEnableComments;
	}

	public void setBlogPostEnableComments(boolean blogPostEnableComments) {
		this.blogPostEnableComments = blogPostEnableComments;
	}

	public String getBlogPostTitle() {
		return this.blogPostTitle;
	}

	public void setBlogPostTitle(String blogPostTitle) {
		this.blogPostTitle = blogPostTitle;
	}

	public String getBlogPostUrl() {
		return this.blogPostUrl;
	}

	public void setBlogPostUrl(String blogPostUrl) {
		this.blogPostUrl = blogPostUrl;
	}

	public List<BlogPostComment> getBlogPostComments() {
		return this.blogPostComments;
	}

	public void setBlogPostComments(List<BlogPostComment> blogPostComments) {
		this.blogPostComments = blogPostComments;
	}

	public List<BlogPostTag> getBlogPostTags() {
		return this.blogPostTags;
	}

	public void setBlogPostTags(List<BlogPostTag> blogPostTags) {
		this.blogPostTags = blogPostTags;
	}

	public BlogCategory getBlogCategory() {
		return this.blogCategory;
	}

	public void setBlogCategory(BlogCategory blogCategory) {
		this.blogCategory = blogCategory;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + blogPostId;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BlogPost other = (BlogPost) obj;
		if (blogPostId != other.blogPostId)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "BlogPost [blogPostId=" + blogPostId + ", blogPostAuthor="
				+ blogPostAuthor + ", blogPostContent=" + blogPostContent
				+ ", blogPostDate=" + blogPostDate
				+ ", blogPostEnableComments=" + blogPostEnableComments
				+ ", blogPostTitle=" + blogPostTitle + ", blogPostUrl="
				+ blogPostUrl + ", blogPostComments=" + blogPostComments
				+ ", blogPostTags=" + blogPostTags + ", blogCategory="
				+ blogCategory + "]";
	}

}